export default {
    countDown(value, format) {
        let timediff = Number(value);
        if (timediff == 0 || timediff == "" || !timediff) {
            return "";
        }
        if (isNaN(timediff)) {
            return "";
        }
        // value--; //自行选择哪里减一
        // let timediff = Math.round(value - nowTime); //获取时间差
        let day = parseInt(timediff / 60 / 60 / 24);
        let hr = parseInt(timediff / 60 / 60 % 24);
        let min = parseInt(timediff / 60 % 60);
        let sec = parseInt(timediff % 60);
     
        // day = day > 9 ? day : '0' + day;
        hr = hr > 9 ? hr : '0' + hr;
        min = min > 9 ? min : '0' + min;
        sec = sec > 9 ? sec : '0' + sec;
        // 返回值
        switch (format) {
            case "dayHH:MM:SS":
                // return `${day}天 ${hr}:${min}:${sec}`;
                return (day > 0 ? day + "天" : "") + ` ${hr}:${min}:${sec}`
                break;
            default:
                return {day,hr,min,sec};
                break;
        }
    },
}